package com.ricky04.web;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * 之前可能是webmvcCOnfigurationAdapter
 * WebMvcConfigurationSupport
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
//public class WebConfig extends WebMvcConfigurerAdapter{
   /* @Bean
    public ViewResolver getViewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("classpath:/ftl/");
        resolver.setSuffix(".ftl");
        return resolver;
    }*/
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("webconfig");
        registry.addInterceptor(new LogHandler()).addPathPatterns("/**");
    }
}
